import React from 'react'
import { Switch,Route,Redirect} from 'react-router-dom'
export default function RouterView(props) {
  return (
    <React.Suspense fallback="">
        <Switch>
            {
                props.routes.map(item =>{
                    return <Route key={item.id} exact={item.exact} path={item.path} render={(routProps)=>{
                        return <item.component routes={item.children} {...routProps} ></item.component>
                    }}></Route>
                })
            }
        </Switch>
        {/* <Redirect from='/' to="/login"></Redirect> */}
    </React.Suspense>
  )
}
